package com.dhcc.bpm.modules.desk.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dhcc.bpm.modules.desk.entity.Notice;
import com.dhcc.bpm.modules.desk.mapper.NoticeMapper;
import com.dhcc.bpm.modules.desk.vo.NoticeVO;
import com.dhcc.bpm.modules.desk.service.INoticeService;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.secure.utils.SecureUtil;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName NoticeServiceImpl
 * @Description  API访问控制表 服务实现类
 * @Author YZC
 * @Date 2019/11/19 14:46
 * @Version V1.0
 * @Copyright: 2020 东华软件 . All rights reserved.
 */
@Service
public class NoticeServiceImpl extends BaseServiceImpl<NoticeMapper, Notice> implements INoticeService {

	@Override
	public IPage<NoticeVO> selectNoticePage(IPage<NoticeVO> page, NoticeVO notice) {
		// 若不使用mybatis-plus自带的分页方法，则不会自动带入tenantId，所以我们需要自行注入
		notice.setTenantId(SecureUtil.getTenantId());
		return page.setRecords(baseMapper.selectNoticePage(page, notice));
	}
	/**
	 * 查询通知信息列表
	 * @param notice
	 * @return
	 */
	@Override
	public List<Notice> listNotices(Notice notice) {
		return baseMapper.listNotices(notice);
	}
	/**
	 *  清空信息
	 * @param notice
	 * @return
	 */
	@Override
	public boolean updateNotice(Notice notice) {
		return baseMapper.updateNotice(notice);
	}
}
